import { StateMachine } from "./StateMachine";

/**
 * 状态机事件接口
 */
export interface StateMachineEvent {
    type: string;
    data?: any;
}

/**
 * 条件函数类型
 */
export type ConditionFunction = () => boolean;

/**
 * 状态转换配置
 */
export interface StateTransition {
    from: string;
    to: string;
    event?: string;
    condition?: ConditionFunction;
    guard?: ConditionFunction; // 额外的守护条件
}

/**
 * 状态配置接口
 */
export interface StateConfig {
    name: string;
    onEnter?: () => void;
    onExit?: () => void;
    onUpdate?: (deltaTime: number) => void;
    
    subStateMachine?: StateMachine; // 嵌套子状态机
}

/**
 * 状态机配置接口
 */
export interface StateMachineConfig {
    initialState: string;
    states: StateConfig[];
    transitions: StateTransition[];
    context?: Record<string, any>; // 上下文数据
}
